import * as React from 'react';

import { StyleSheet, View, Text, ToastAndroid } from 'react-native';
import { VivoPush } from 'react-native-cn-push';

export default function App() {
  React.useEffect(() => {
    initIt();
  }, []);

  const initIt = async () => {
    await VivoPush.init();
  };

  const test = () => {
    VivoPush.register((token: string) => {
      ToastAndroid.show(token, ToastAndroid.SHORT);
    });
  };

  return (
    <View style={styles.container}>
      <Text onPress={test} style={styles.test}>
        Please test in your project
      </Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  test: {
    fontSize: 20,
    backgroundColor: 'red',
  },
});
